<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>资讯管理</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('add')}">新增发布</a>
        </div>
        <div class="search-form fl">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="输入关键字">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
            <!--            <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteUser')}" target-form="ids">删 除</button>-->
        </div>
        <div class="fl">
            <select name="eid" id='eid'>
                <option value="0">选择赛事筛选</option>
                <volist name="eventList" id="vo">
                    <option value="{$vo.event_id}" <eq name="eid" value="$vo['event_id']"> selected </eq>>{$vo.event_name}</option>
                </volist>
            </select>
        </div>

        <!-- 高级搜索 -->
        <div class="fr cf">
            <!--<a class="btn" href="{:U('zizhi')}">资质设置</a>-->

        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <input type="hidden" id="masters_id" name="id" value="{space{$data.id}"/>
        <form  >
            <table width="100%">
                <thead>
                    <tr>
                        <th>分组<a href="javascript:;" style="margin-left:20px;color:#3A6EA5;" onclick="window.top.artiframe('{space{:U('Master / group_detail')}', '添加分组', 400, 200, true, false, false, addbtn, 'add', true);">添加分组</a>
                        <th> <span>准确风格</span>
                            <div class="operate">
                                <!--                        <input type="button" name="" value="保存">-->
                                <!--                        <input type="button" name="" value="取消">-->
                            </div>
                        </th>
                    </tr>
                </thead>
                <volist name="result" id="vo">
                    <tr>
                        <th width="100" class="center dele_edit">
                            <a href="javascript:void(0);" class="delete" data-id="{space{$vo['id']}">删除</a>
                            <a href="javascript:void(0);" onclick="window.top.artiframe('{space{:U('Master / group_detail',array('id'=>$vo['id']))}', '编辑分组', 400, 200, true, false, false, addbtn, 'add', true);" class="edit">编辑</a>
                            <span>{space{$vo.words}-{space{$vo.name}</span>
                        </th>
                        <td width="400" class="addText">
                            <p style="cursor: pointer;" onclick="window.top.artiframe('{space{:U('Master / group_detail',array('pid'=>$vo['id']))}', '编辑分组', 400, 200, true, false, false, addbtn, 'add', true);">添加风格</p>
                    <volist name="vo['child']" id="child">
                        <div class="add_style">
                            <a href="javascript:void(0);" class="delete" data-id="{space{$child['id']}">删除</a>
                            <a href="javascript:void(0);" onclick="window.top.artiframe('{space{:U('Master / group_detail',array('id'=>$child['id'],'pid'=>$child['pid']))}', '编辑分组', 400, 200, true, false, false, addbtn, 'add', true);" class="edit">编辑</a>
                            <span>{space{$child.name}</span>
                        </div>
                    </volist>

                    </td>
                    </tr>
                </volist>
            </table>

        </form>
        <!--        <table class="">
                    <thead>
                        <tr>
                            <th class="">序号</th>
                            <th class="">文章标题</th>
                            <th class="">所属赛事</th>
                            <th class="">点击量</th>
                            <th class="">发布时间</th>
                            <th class="">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    <notempty name="_list">
                        <volist name="_list" id="vo">
                            <tr>
                                <td>{$vo.news_id}</td>
                                <td>{$vo.news_title} </td>
                                <td>{$vo.event}</td>
                                <td>{$vo.hit}</td>
                                <td>{$vo.create_time}</td>
                                <td>
                                    <a href="{:U('edit',array('nid'=>$vo['news_id']))}" class="">编辑</a>
                                    <a href="{:U('del',array('nid'=>$vo['news_id']))}" class="confirm ajax-get">删除</a>
                                </td>
                            </tr>
                        </volist>
                        <else/>
                        <td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
                    </notempty>
                    </tbody>
                </table>-->
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
                                $('.delete').click(function(){
                                var id = $(this).data('id');
                                if (confirm('确认删除?')){
                                $.post("<?php echo U('Group/delgroup'); ?>", {'id': id}, function(data){
                                if (data.error_code == '0') {
                                window.location.reload()
                                } else {
                                alert(data.error_msg)
                                }
                                })
                                }
                                })
                                        //搜索功能
                                        $("#search").click(function () {
                                var url = $(this).attr('url');
                                var query = $('.search-form').find('input').serialize();
                                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                                query = query.replace(/^&/g, '');
                                if (url.indexOf('?') > 0) {
                                url += '&' + query;
                                } else {
                                url += '?' + query;
                                }
                                window.location.href = url;
                                });
                                //回车搜索
                                $(".search-input").keyup(function (e) {
                                if (e.keyCode === 13) {
                                $("#search").click();
                                return false;
                                }
                                });
                                //导航高亮
                                highlight_subnav("{:U('Group/index')}");
    </script>
</block>
